public class Test {
    public static void main(String[] args) {
        Teacher teacher1 = new Teacher("T001", "张老师", "男");
        Teacher teacher2 = new Teacher("T002", "李老师", "女");

        Course course1 = new Course("C001", "Java 编程", "A101", "周一 8:00-10:00");
        Course course2 = new Course("C002", "数据结构", "B202", "周二 14:00-16:00");

        teacher1.setCourse(course1);
        teacher2.setCourse(course2);
        course1.setTeacher(teacher1);
        course2.setTeacher(teacher2);

        System.out.println(teacher1.getName() + " 开设课程：" + teacher1.getCourse().getName());
        System.out.println(teacher2.getName() + " 开设课程：" + teacher2.getCourse().getName());

        Student student1 = new Student("S001", "小明", "男");
        Student student2 = new Student("S002", "小红", "女");

        student1.selectCourse(course1);
        student2.selectCourse(course2);

        System.out.println(student1.getName() + " 选了课程：" + student1.getCourse().getName());
        System.out.println(student2.getName() + " 选了课程：" + student2.getCourse().getName());

        student2.dropCourse();
        System.out.println(student2.getName() + " 退课");

        printCourseTable(student1);
        printCourseTable(student2);
    }

    public static void printCourseTable(Student student) {
        System.out.println("学生 " + student.getName() + " 的课表：");
        Course course = student.getCourse();
        if (course != null) {
            System.out.println("课程编号：" + course.getId());
            System.out.println("课程名称：" + course.getName());
            System.out.println("上课地点：" + course.getLocation());
            System.out.println("上课时间：" + course.getTime());
            System.out.println("授课教师：" + course.getTeacher().getName());
        } else {
            System.out.println("暂无选课记录");
        }
        System.out.println("------------------------");
    }
}